<template>
  <div class="project_list animate__animated animate__fast flex"
    :class="[{ animate__fadeInRightBig: isshow == 1 }, { animate__fadeOutRightBig: isshow == 2 }]" v-show="isshow != 0">
    <div class="flex event_return" @click="isshow = 2">
      <span class="iconfont icon-arrowLeft"></span>
      <span>返回项目列表</span>
    </div>
    <TitleHeader title="医疗应用" event-name="添加任务" @add="addEvent" />
    <div class="project_list_main flex-1">
      <Detalis />
      <ProjectMain />
      <TaskDetails />

    </div>
  </div>
  <el-dialog v-model="showAddEvent" title="添加任务" style="width: 500px;padding: 20px;border-radius: 20px;"
    :close-on-click-modal="false">
    <el-form label-position="top" label-width="100px" :model="task" style="max-width: 460px">
      <el-form-item label="任务名称">
        <el-input v-model="task.name" />
      </el-form-item>
      <el-form-item label="任务分组">
        <el-select v-model="task.group" class="select" placeholder="Select">
        </el-select>
      </el-form-item>
      <el-form-item label="优先等级">
        <el-select v-model="task.level" class="select" placeholder="Select">
          <el-option v-for="item in levelArr" :key="item" :label="item" :value="item" />
        </el-select>
      </el-form-item>
      <el-form-item label="执行人">
        <el-select v-model="task.user!.name" class="select" placeholder="Select">
        </el-select>
      </el-form-item>
      <el-form-item label="描述">
        <el-input v-model="task.desc" type="textarea" />

      </el-form-item>

    </el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button type="primary" @click="showAddEvent = false">
          保存任务
        </el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script setup lang="ts">
import Detalis from '@/components/task/details.vue';
import ProjectMain from './project_main.vue';
import TaskDetails from './task_detail.vue';
import TitleHeader from '@/components/titleHeader/index.vue';

import { inject, ref, reactive, Ref } from 'vue'
import { IAddTask } from '@/types/project';
const levelArr = ["低", "中", "高"]
// const props = defineProps<{}>()

const showAddEvent = ref(false)
const task = reactive<IAddTask>({
  name: "",
  group: "",
  level: "",
  createTime: '',
  endTime: '',
  user: {
    id: "",
    name: ""
  },
  desc: ""
})
const isshow = inject("isshow");

function addEvent() {
  showAddEvent.value = true
}

</script>

<style lang="scss" scoped>
.select {
  width: 100%;
  height: 60px;
}

.project_list {
  position: absolute;
  background-color: #f4f4f4;
  inset: 0;
  flex-direction: column;
  margin-bottom: 10px;


  :deep(.header) {
    margin: 0 !important;
  }

  &_main {
    display: flex;
    box-sizing: border-box;
    gap: 20px;
    margin-top: 10px;
  }
}

.event_return {
  color: #3F8CFF;
  font-size: 14px;
  gap: 5px;
  margin-top: 20px;
  align-items: center;
  width: max-content;
  border-bottom: 1px solid transparent;


  .iconfont {
    font-size: 20px;
    font-weight: bold;
  }

  &:hover {
    border-bottom: 1px solid #3F8CFF;
  }
}
</style>